import service from '@/utils/request'

// 哪个目录下
const WHERE = '/admin/category'

// 获取分类内容
export function getCategoryApi() {
  return service({
    method: 'get',
    url: `${WHERE}/list`
  })
}

// 删除分类内容
export function delCategoryByIdApi(categoryId) {
  return service({
    method: 'post',
    url: `${WHERE}/del`,
    data: { id: categoryId }
  })
}

// 获得单个分类信息
export function getCategoryByIdApi(id) {
  return service({
    method: 'get',
    url: `${WHERE}`,
    params: { id }
  })
}

// 修改分类
export function saveCategoryApi(categoryForm) {
  return service({
    method: 'post',
    url: `${WHERE}/save`,
    data: categoryForm
  })
}

// 添加分类
export function addCategoryApi(categoryForm) {
  return service({
    method: 'post',
    url: `${WHERE}/add`,
    data: categoryForm
  })
}